<!doctype html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>统计图表-WeAdmin Frame型后台管理系统-WeAdmin 1.0</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" href="../../static/css/font.css">
    <link rel="stylesheet" href="../../static/css/weadmin.css">
    <script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.5.1.min.js"></script>
</head>

<body>
<div class="weadmin-nav">
			<span class="layui-breadcrumb">
        <a href=""><cite>首页</cite></a>
        <a href=""><cite>数据统计</cite></a>
        <a>
          <cite>折线图</cite></a>
      </span>
    <a class="layui-btn layui-btn-sm" style="margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon layui-icon-refresh"></i></a>
</div>
<div class="weadmin-body">
    <blockquote class="layui-elem-quote">
        订单管理系统数据可视化
    </blockquote>
    <!-- 为 ECharts 准备一个具备大小（宽高）的 DOM -->
    <div id="main" style="width: 100%;height:460px;"></div>
</div>
<script src="//cdn.bootcss.com/echarts/4.0.2/echarts.min.js"></script>
<script type="text/javascript">
    //从后端调取数据
    $.get({
        url: "/index/all",
        success: function (data) {
            var data_all = data.split(",")
            // 基于准备好的dom，初始化echarts实例
            var myChart = echarts.init(document.getElementById('main'));

            var option = {
                title: {
                    left: 'center',
                    top: 20,
                    textStyle: {
                        color: '#ccd'
                    }
                },
                legend: {
                    data: ['用户数量', '管理员数量', '商品数量', '订单数量']
                },
                tooltip: {
                    trigger: 'item',
                    formatter: '{a} <br/>{b} : {c} ({d}%)'
                },

                visualMap: {
                    show: false,
                    min: 80,
                    max: 600,
                    inRange: {
                    }
                },
                series: [
                    {
                        name: '信息统计',
                        type: 'pie',
                        radius: '55%',
                        center: ['50%', '50%'],
                        data: [
                            {value: data_all[0], name: '用户数量',itemStyle: { normal:{color: '#4C82FF'}}},
                            {value: data_all[1], name: '管理员数量',itemStyle: { normal:{color: '#84E363'}}},
                            {value: data_all[2], name: '商品数量',itemStyle: { normal:{color: '#F6A851'}}},
                            {value: data_all[3], name: '订单数量',itemStyle: { normal:{color: '#c23111'}}}
                        ].sort(function (a, b) { return a.value - b.value; }),
                        roseType: 'radius',
                        label: {

                        },
                        labelLine: {
                            lineStyle: {

                            },
                            smooth: 0.2,
                            length: 10,
                            length2: 20
                        },
                        animationType: 'scale',
                        animationEasing: 'elasticOut',
                        animationDelay: function (idx) {
                            return Math.random() * 200;
                        }
                    }
                ]
            };
            // 使用刚指定的配置项和数据显示图表。
            myChart.setOption(option);
        }
    })
</script>
</body>

</html>